<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('检测列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row" id="printArea">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <input type="hidden" name="orderId" th:value="${orderId}"/>
                    <ul>
                        <li>
                            蔬菜批次：<input type="text" name="piciCode"/>
                        </li>

                        <li>
                            检测结果：<select name="checkResult" th:with="type=${@dict.getType('checkResult')}">
                            <option value="">所有</option>
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                    th:value="${dict.dictValue}"></option>
                        </select>
                        </li>


                        <li class="select-time">
                            <label>检测时间： </label>
                            <input type="text" class="time-input" id="startTime" placeholder="开始时间"
                                   name="params[beginTime]"/>
                            <span>-</span>
                            <input type="text" class="time-input" id="endTime" placeholder="结束时间"
                                   name="params[endTime]"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <div class="btn-group-sm" id="toolbar1" role="group">

            <div class="btn-group-sm" id="toolbar" role="group">
               <!-- <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:ncCheck:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()"
                   shiro:hasPermission="system:ncCheck:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()"
                   shiro:hasPermission="system:ncCheck:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>-->
                <a class="btn btn-warning" onclick="$.table.exportExcel()">
                    <i class="fa fa-download"></i> 导出
                </a>
                <a class="btn btn-warning" id="print-btn" orderType = "4">
                    <i class="fa fa-download"></i> 打印
                </a>
            </div>
        </div>
        <h3 align="center"> <span th:text="检测记录单" id="ordercode" hidden="hidden"></span> </h3>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table" data-mobile-responsive="true"></table>
            <h3> <span id="autograph" hidden="hidden"></span> </h3>
        </div>
    </div>
    <div class="bottom-btns"></div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:ncCheck:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:ncCheck:remove')}]];
    var prefix = ctx + "system/ncCheck";
    var datas = [[${@dict.getType('check_result')}]];
    $(function () {
        var options1 = {
            url: prefix + "/list?orderId="+[[${orderId}]],
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export?orderId="+[[${orderId}]],
            modalName: "检测",
            showSearch: false,
            showRefresh: false,
            showColumns: false,
            showToggle: false,
            showExport: false,
            striped: true,
            toolbar: 'toolbar1',
            columns: [
             /*   {
                checkbox: true
            }, */
                {
                title: '序号',
                formatter: function (value, row, index) {
                    return $.table.serialNumber(index);
                }
            },
                {
                    field: 'checkId',
                    title: '检测id',
                    visible: false
                },{
                    field: 'ncorderCf.cforderCode',
                    title: '订单编号',
                    formatter: function (value, row, index) {
                        if (row.ncorderCf.isCheck == '1') {
                            return '--'
                        } else {
                            return row.ncorderCf.cforderCode
                        }

                    }

                },
                {
                    field: 'piciCode',
                    title: '蔬菜批次',
                    sortable: true
                },{
                    field: 'ncorderCf.cropNameCn',
                    title: '作物名称',
                    sortable: true
                },
                {
                    field: 'ncorderCf.cropVarietiesCn',
                    title: '作物品种',
                    sortable: true
                },
                {
                    field: 'teamCn',
                    title: '生产班组',
                    sortable: true

                },
                {
                    field: 'yzl',
                    title: '抑制率(%)',
                    sortable: true
                },
                {
                    field: 'checkResult',
                    title: '检测结果',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(datas, value);
                    }
                },
                {
                    field: 'checkTime',
                    title: '检测时间',
                    sortable: true
                },
                {
                    field: 'checkUser',
                    title: '检测人员',
                    sortable: true
                },
                {
                    field : 'remark',
                    title : '备注',
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value);
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.checkId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.checkId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };


        /*状态:1：待确认 2：已挂起 3：已确认：4：已生成订单*/
        $.table.init(options1);


    });
    setTitle("检测记录单-预览",true)
</script>
</body>
</html>